//https://leetcode.cn/problems/intersection-of-two-arrays/description/

class Solution {
public:
    vector<int> intersection(vector<int>& nums1, vector<int>& nums2) 
    {
        set<int> s1(nums1.begin(),nums1.end());
        set<int> s2(nums2.begin(),nums2.end());
        vector<int> ret;

        set<int>::iterator it1=s1.begin();
        set<int>::iterator it2=s2.begin();

        while(it1!=s1.end()&&it2!=s2.end())
        {
            if(*it1<*it2)
            {
                it1++;
            }
            else if(*it1>*it2)
            {
                it2++;
            }
            else
            {
                ret.push_back(*it1);
                it1++;
                it2++;
            }
        }

        return ret;

    }
};

//https://www.nowcoder.com/practice/16f59b169d904f8898d70d81d4a140a0?tpId=94&tqId=31064&rp=1&ru=%2Factivity%2Foj&qru=%2Fta%2Fbit-kaoyan%2Fquestion-ranking&tPage=2

#include <cctype>
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
using namespace std;

bool cmp(const pair<string,int>& p, const pair<string,int>& q)
{
    return p.second>q.second;
}

int main() 
{
    map<string,int> hash;
    string s;
    while(getline(cin, s))
    {
        for(int i=0,j=0;j<s.size();j++)
        {
            if(s[j]==' '||s[j]=='.')
            {
                if(isupper(s[i]))
                s[i]=tolower(s[i]);
                string temp=s.substr(i,j-i);
                i=j+1;
                hash[temp]++;
            }
        }
        vector<pair<string,int>> v(hash.begin(),hash.end());
        sort(v.begin(),v.end(),cmp);
        for(auto &[a,b]:v)
        {
            cout<<a<<":"<<b<<endl;
        }
    }

    return 0;
}